<template>
  <div class="total">
    <div class="haircut">
      <img style="margin-left: 60px;width: auto;height: 100%" src="../assets/login/tenant-logo.png"/>
      <div class="vertical-line"></div>
      <h3>采购管理平台</h3>
      <div class="contact-us">
        <span>门户网站</span>
        <span>服务热线</span>
      </div>
    </div>
    <el-form class="login">
      <template>
        <el-tabs v-model="activeIndex" @tab-click="handleClick()">
          <el-tab-pane label="账密登陆 " name="1"></el-tab-pane>
          <el-tab-pane label="短信登陆 " name="2"></el-tab-pane>
          <el-tab-pane label="微信登陆 " name="3"></el-tab-pane>
        </el-tabs>
      </template>
      <div v-if="activeIndex == 1">
        <el-form-item label="用户名">
          <el-input type="text" placeholder="请输入用户名"/>
        </el-form-item>
        <el-form-item label="密码">
          <el-input type="password" placeholder="请输入密码"/>
        </el-form-item>
      </div>
      <div v-if="activeIndex == 2">
        <el-form-item label="手机号">
          <el-input type="text"  placeholder="请输入手机号"/>
        </el-form-item>
        <el-form-item label="图片验证码">
          <el-input type="text"  placeholder="请输入验证码"/>
          <img @click="refreshCaptcha()" alt="../assets/login/tenat-logo.png"/>
        </el-form-item>
        <el-form-item label="验证码">
          <el-input type="password"/>
        </el-form-item>
      </div>
      <div v-if="activeIndex == 3">
        <div style="width: 200px;height: 200px;border: 1px solid">
          我是验证码
        </div>
      </div>
      <el-button @click="submitForm">提交</el-button>
    </el-form>
  </div>
</template>
<script>
// 引入封装的 axios 实例
import axiosInstance from '../utils/axios'
export default ({
  data(){
    return{
      activeIndex: '1',
      loginDto: {
        img: '',
        username: 'fromCache',
        password: '*************'
      }
    }
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    submitForm(){
      alert("访问后端端口！！")
    },
    refreshCaptcha(){
      try {
        axiosInstance.get('/base/code/captcha').then(resp=>{
          alert(resp.data.data)
        });
      }catch (e){
        alert(e.message)
      }
    }
  }
})
</script>
<style scoped>
.total{
  display: flex;
  flex-direction: row;
  margin-top: 0px;
}
.body {
  //background-image: url('@/assets/login/china-cup.png');
  //background-repeat: no-repeat;
  //background-size: contain;
  //background-position: center;
  //min-height: 100vh; /* 确保至少占据整个视口高度 */
}
.haircut{
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 5%;
  position: absolute;
  top: 0px;
  border: solid 1px beige;
  align-items: center;
}
.vertical-line{
  margin-left: 10px;
  width: 10px;
  height: 100%;
  border-left: 1px solid black;
}
.contact-us {
  margin-left: auto; /* 将.contact-us 推到最右边 */
  margin-right: 100px; /* 可以根据需要添加右侧边距 */
}
.contact-us span{
  font-family: "Songti SC";
  font-size: medium;
  margin-right: 20px; /* 可以根据需要添加右侧边距 */
  font-weight: bold;
}
.login{
  position: absolute;
  top: 200px;
  right: 250px;
  width: 380px;
  height: 400px;
  background: yellow;
  padding: 40px;
  align-content: center;
}
</style>